package edu.ynu.se.xiecheng.achitectureclass.dao;

import edu.ynu.se.xiecheng.achitectureclass.common.dao.LogicDAO;
import edu.ynu.se.xiecheng.achitectureclass.entity.CameraData;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface CameraDataDao extends LogicDAO<CameraData, Long> {
    @Query("SELECT c FROM CameraData c WHERE c.isDeleted = 0 AND c.deviceId = :deviceId ORDER BY c.createTime DESC")
    List<CameraData> findByDeviceId(@Param("deviceId") Long deviceId);

    @Query("SELECT c FROM CameraData c WHERE c.isDeleted = 0 AND c.deviceId = :deviceId ORDER BY c.createTime DESC")
    List<CameraData> findLatestByDeviceId(@Param("deviceId") Long deviceId, org.springframework.data.domain.Pageable pageable);
} 